package com.treasure.web.mapstruct;

import com.treasure.infrastructure.model.po.CorpInfo;
import com.treasure.infrastructure.model.po.CorpRoleInfo;
import com.treasure.infrastructure.model.po.CorpUserInfo;
import com.treasure.web.command.response.AccountUserInfoResponse;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author sunhongmin
 * @date 2023/9/3 20:40
 * @description
 */
@Mapper
public interface CorpUserInfoAssembler {
    CorpUserInfoAssembler INSTANCE = Mappers.getMapper(CorpUserInfoAssembler.class);

    @Mapping(source = "corpUserInfo.id", target = "id")
    @Mapping(source = "corpUserInfo.corpId", target = "corpId")
    @Mapping(source = "corpUserInfo.userId", target = "userId")
    @Mapping(source = "corpUserInfo.username", target = "username")
    @Mapping(source = "corpUserInfo.avatar", target = "avatar")
    AccountUserInfoResponse buildAccountUserInfo(CorpUserInfo corpUserInfo);

    AccountUserInfoResponse.UserCorpInfoResponse buildCorpInfo(CorpInfo corpInfo);

    List<AccountUserInfoResponse.UserCorpInfoResponse> buildCorpInfo(List<CorpInfo> corpInfoList);

    AccountUserInfoResponse.UserRoleInfoResponse buildRoleInfo(CorpRoleInfo corpRoleInfo);

    List<AccountUserInfoResponse.UserRoleInfoResponse> buildRoleInfo(List<CorpRoleInfo> corpRoleInfoList);

}
